﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Data;

namespace IkeCode.WP7.HQReader.Base.Converters
{
    /// <summary>
    /// Convert bool to Visibility
    /// </summary>
    public class BoolToVisibility : IValueConverter
    {
        /// <summary>
        /// Convert bool to visibility
        /// </summary>
        /// <param name="value">Bool value</param>
        /// <param name="targetType">Target type</param>
        /// <param name="parameter">Parameter</param>
        /// <param name="culture">Culture info</param>
        /// <returns>System.Windows.Visibility</returns>
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return ((bool)value) ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
        }

        /// <summary>
        /// Convert Visibility to bool
        /// </summary>
        /// <param name="value">Visibility value</param>
        /// <param name="targetType">Target type</param>
        /// <param name="parameter">Parameter</param>
        /// <param name="culture">Culture info</param>
        /// <returns>bool</returns>
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return ((System.Windows.Visibility)value == System.Windows.Visibility.Visible);
        }
    }
}
